#ifndef DEFER_IMPL_H
#define DEFER_IMPL_H

#include <functional>

using Functor = std::function<void()>;

class CXDeferImpl
{

public:
    inline CXDeferImpl(const Functor &functor);
    inline CXDeferImpl(Functor &&functor);
    inline CXDeferImpl(CXDeferImpl &&another);
    inline ~CXDeferImpl();

private:
    // 不允许拷贝, 赋值
    CXDeferImpl(const CXDeferImpl &another) = delete;
    CXDeferImpl operator=(const CXDeferImpl &another) = delete;
    CXDeferImpl operator=(CXDeferImpl &&another) = delete;

private:
    Functor m_func;
    bool m_valid;
};

#endif
